package com.room;

import android.content.Context;

import com.room.observeroom.Score;
import com.room.observeroom.ScoreDao;

import java.net.ContentHandler;

import androidx.room.Dao;
import androidx.room.Database;
import androidx.room.Insert;
import androidx.room.Room;
import androidx.room.RoomDatabase;

@Database(entities = {Score.class, User.class}, version = 1, exportSchema = false)
public abstract class AppDatabase extends RoomDatabase {

    private static AppDatabase INSTANCE;

    public abstract UserDao getUserDao();

    public abstract ScoreDao getScoreDao();


    public static synchronized AppDatabase getInstance(Context context) {
        if (INSTANCE == null) {
            INSTANCE = Room.databaseBuilder(context, AppDatabase.class, "appdata")
                    .allowMainThreadQueries()
                    .build();
        }

        return INSTANCE;
    }


}
